<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'show.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
 
  <body>
    //因为servlet中用到的是一个名叫cart的map对象，所以在此获取其值也要获取map对象的值
   <%Map map = (Map)session.getAttribute("cart"); %>  
    <h1>你的购物车里有</h1>
    <p>
    <%=map.get("apple")+"斤苹果" %>
    <%=map.get("banana") +"斤香蕉"%>
    <%=map.get("grape") +"斤葡萄"%>
    </p>
    <hr>
    <hr>
    <a href="/myPro/index.jsp">回到水果店</a>
  </body>
  
  
  //或者用如下方式
 
 <body>
   <% 
      String apple=session.getAttribute("apple").toString();    
      String banana=session.getAttribute("banana").toString();
     String grape=session.getAttribute("grape").toString();
   %>     
   //因为用的session存储请求信息，所以为了在该页面显示，就要用到session.getAttribute()方法获取要显示信息值 
   <h1>你的购物车里有</h1>
    <p>
    <%=apple+"斤苹果"%>
    <%=banana+"斤香蕉"%>
    <%=grape+"斤葡萄"%>
    </p>
    <hr>
    <hr>
    <a href="/myPro/index.jsp">回到水果店</a>
  </body>
  
  
  
  
  
  

</html>

